
export default (enforce) => {
  const virtualFileId = '@my-virtual-file'
    return {
      name: 'my-plugin',
      enforce: enforce | 'pre',
      resolveId(id) {
        if (id === virtualFileId) {
          return virtualFileId
        }
      },
      buildStart() {
        console.log('buildStart', enforce)
      },
      /**
       * 打包结束了但还没用生成文件
       */
      buildEnd() {
        console.log('结束', enforce);
      },
      /**
       * 生成文件服务器关闭
       */
      closeBundle() {
        require('../build/build.js')
      }
      // resolveId() {
      //   console.log('resolveId', enforce)
      // },
      // load() {
      //   console.log('load', enforce)
      // }
    }
  }